﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoreRay
{
    public class Plane : ParametricSurface
    {
        public Plane() : this(1.0f, 1.0f)
        {
        }

        public Plane(float width, float height)
        {
            this.Width = width;
            this.Height = height;
            this.Generate();
        }

        public float Width
        {
            get;
            set;
        }

        public float Height
        {
            get;
            set;
        }

        protected override Vector3 ComputeVertexPosition(float s, float t)
        {
            float x = (this.Width * s) - (this.Width * 0.5f);
            float y = 0.0f;
            float z = (this.Height * t) - (this.Height * 0.5f);

            return new Vector3(x, y ,z);
        }

        protected override Vector3 ComputeVertexNormal(float s, float t)
        {
            return new Vector3(0, 1, 0);
        }
    }
}
